package com.example.distributed.locks.controller;

import com.example.distributed.locks.annotations.RedisLock;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 谢汉冰
 * @Title: TestController
 * @Package com.example.distributed.locks.controller
 * @date 2023/10/23 15:25
 * @description:
 */
@RestController
@RequestMapping("/test")
public class TestController {


	@GetMapping("/{id}")
	@RedisLock(name = "testcontroller.testquery.lock")
	public String test(@PathVariable("id") String id) throws InterruptedException {
		Thread.sleep(5 * 1000);
		return "s1";
	}
}
